import request from '@/config/axios'

// 药品库存 VO
export interface MedicineInventoryVO {
  inventoryId: number // 库存ID
  userId: number // 用户ID
  medicineId: number // 药品ID
  totalQuantity: number // 总数量
  currentQuantity: number // 当前数量
  unit: string // 单位(如片、粒)
  expiryDate: Date // 有效期
  lowStockThreshold: number // 低库存阈值
  lastUpdate: Date // 最后更新时间
}

// 药品库存 API
export const MedicineInventoryApi = {
  // 查询药品库存分页
  getMedicineInventoryPage: async (params: any) => {
    return await request.get({ url: `/remind/medicine-inventory/page`, params })
  },

  // 查询药品库存详情
  getMedicineInventory: async (id: number) => {
    return await request.get({ url: `/remind/medicine-inventory/get?id=` + id })
  },

  // 新增药品库存
  createMedicineInventory: async (data: MedicineInventoryVO) => {
    return await request.post({ url: `/remind/medicine-inventory/create`, data })
  },

  // 修改药品库存
  updateMedicineInventory: async (data: MedicineInventoryVO) => {
    return await request.put({ url: `/remind/medicine-inventory/update`, data })
  },

  // 删除药品库存
  deleteMedicineInventory: async (id: number) => {
    return await request.delete({ url: `/remind/medicine-inventory/delete?id=` + id })
  },

  // 导出药品库存 Excel
  exportMedicineInventory: async (params) => {
    return await request.download({ url: `/remind/medicine-inventory/export-excel`, params })
  },
}